<?php
/**
 *  留言控制器
 */
namespace app\admin\controller;

use think\Controller;
use app\admin\model\Message as MessageModel;
class Message extends Common
{

    private $model;
	private $PageCount;

    public function _initialize()
    {
		parent::_initialize();
        $this->model = new MessageModel();
		$this->PageCount=20;
    }

    // 列表
    public function index()
    {
		$UrlParam=input();
		$list=$this->model->getList($UrlParam,$this->PageCount);
        $this->assign('list',$list);
		$this->assign('UrlParam', $UrlParam);
        return $this->fetch();
    }

    // 删除
    public function del()
    {
        if (!$id = input('id/s')) {
            $this->error('传递的参数值错误！', - 1);
        }
        
        if ($this->model->delMessage($id)) {
             $this->success('删除成功！',url('/Message/index'));
        } else {
            $this->error('删除失败！', url('/Message/index'));
        }
    }
}